<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1.字面量创建对象  单例模式  增加可读性
    var cookie = {
      myurl: "http://www.baidu.com",
      setCookie: function () {
        console.log(this.myurl)
      },
      getCookie: function () { },
      delCookie: function () { }
    }
    //2. 构造法
    // var obj = new Object();

    // 3. 原型链法创建 只能创建类似对象
    var dog = {
      name: "来福",
      color: "红色",
      wang: function () { }
    }
    var cat = {}
    cat.__proto__ = dog;
    console.log(cat)
  </script>
</body>

</html>